package com.ccc.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ccc.dao.DestributeDao;
import com.ccc.model.Destribute;
import com.ccc.util.dao.UtilDao;
@Component("destributeDao")
public class DestributeDaoImpl implements DestributeDao {

	private UtilDao utilDao;
	
	@Override
	public void addDestribute(Destribute destribute) {
		utilDao.save(destribute);
	}

	@Override
	public void deleteDestribute(Destribute destribute) {
		utilDao.delete(destribute);
	}

	@Override
	public void updateDestribute(Destribute destribute) {
		utilDao.update(destribute);
	}

	@Override
	public Destribute findDestribute(int id) {
		return utilDao.find(Destribute.class, id);
	}

	public UtilDao getUtilDao() {
		return utilDao;
	}
	@Resource
	public void setUtilDao(UtilDao utilDao) {
		this.utilDao = utilDao;
	}

	@Override
	public List<Destribute> findFirst() {
		return this.utilDao.find("from Destribute", null);
	}

}
